<template>
  <div class="enterprise-center-page">
    <el-container class="nav-box">
      <el-header>
        <el-row>
          <el-col class="logo-box" :span="6">
            <icon-font class="nav-logo" style="visibility: hidden;" icon="icon-global-001" />
            <span class="logo-name">
              <img :src="active_logo" alt="logo" />
            </span>
          </el-col>
          <el-col :span="18" class="user-info" style="padding-right: 16px;">
            <el-dropdown>
              <div class="el-dropdown-link position">
                <div class="positionInfo">
                  <span>{{ positionCompanyName || companyName || '' }}</span>
                  <span>{{ positionName || '' }}</span>
                </div>
                <i v-if="positionList.length" class="el-icon-arrow-down el-icon--right" />
              </div>
              <el-dropdown-menu slot="dropdown" v-if="positionList.length">
                <el-dropdown-item
                  v-for="(item, index) in positionList"
                  :key="index"
                  @click.native="choosePosition(item.companyId)"
                  style="
                    display: flex;
                    flex-direction: column;
                    text-align: right;
                  "
                >
                  <span>{{ item.companyName }}</span>
                  <span>{{ item.positionName }}</span>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
            <!-- 用户信息，修改密码 -->
            <el-dropdown @command="handleDropdown">
              <span class="el-dropdown-link">
                {{ $store.state.userName || '--' }}
                <i class="el-icon-arrow-down el-icon--right" />
              </span>
              <el-dropdown-menu slot="dropdown">
                <!-- <el-dropdown-item command="putPass">修改密码</el-dropdown-item> -->
                <el-dropdown-item command="userInfo">个人中心</el-dropdown-item>
                <el-dropdown-item v-show="positionId === '0'" command="enterPriseCenter">企业中心</el-dropdown-item>
                <el-dropdown-item command="logout">退出</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-col>
        </el-row>
      </el-header>

      <el-main v-loading="allPageLoading">
        <el-breadcrumb separator-class="el-icon-arrow-right" class="el-breadcrumb-style">
          <el-breadcrumb-item class="text-style" :to="{path: '/'}">首页</el-breadcrumb-item>
          <el-breadcrumb-item id="last-breadcrumb-item">企业中心</el-breadcrumb-item>
        </el-breadcrumb>
        <div class="system-classify-box">
          <div class="classify-title">
            <span class="left-title">
              <i class="el-icon-check"></i>
              <span>企业资料</span>
            </span>
            <el-button class="right-operation" type="text" @click="goEditEnterprise">编辑</el-button>
          </div>
          <div class="line"></div>
          <el-row class="el-row-data">
            <el-col :span="12">
              <span class="left-999-text">企业名称：</span>
              <span class="right-333-text">{{ companyName }}</span>
            </el-col>
            <el-col :span="12">
              <span class="left-999-text">社会统一信用代码：</span>
              <span class="right-333-text">{{ unifiedSocialCreditCode }}</span>
            </el-col>
          </el-row>
          <!-- <div  class="classify-title">
            <span><i class="el-icon-check-glyzl"></i>管理员资料</span>
            <el-button class="right-edit-style" type="text" disabled>编辑</el-button>
          </div>
          <div class="line"></div>
          <el-row class="el-row-data">
             <el-col :span="12" >
              <span class="left-999-text">管理员姓名：</span>
              <span class="right-666-text">{{"国科恒泰（北京）医疗公司私企"}}</span>
             </el-col>
             <el-col :span="12" >
              <span class="left-999-text">管理员手机：</span>
              <span class="right-666-text">{{"180******88"}}</span>
             </el-col>
          </el-row>
          <div style="margin-left:130px;">
            <span class="left-999-text">管理员身份证号：</span>
              <span class="right-666-text">{{"230223*********10"}}</span>
          </div>-->
          <!-- <div class="classify-title">
            <span><i class="el-icon-check-setting"></i>账号设置</span>
          </div>-->
          <div class="main_box">
            <div class="title_box">
              <span class="title_type">
                <i class="el-icon-check-setting"></i>
                <span>账号设置</span>
              </span>
            </div>
            <div class="profile_box profile_set_box">
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <!-- <i class="el-icon-check-management"></i> -->
                  <icon-font icon="iconpc-other_qyzx_zzgl1x"></icon-font>
                </div>
                <div class="account_box">
                  <div class="account_title">组织管理</div>
                  <div class="account_prompt">维护企业组织架构信息，岗位绑定员工，岗位绑定角色权限。</div>
                  <div>
                    <el-button type="text" @click="jumpOrgainzationManagement">
                      <icon-font icon="iconpc-other_qgl1x"></icon-font>去管理
                    </el-button>
                    <el-button
                      type="text"
                      @click="showVideo('https://m.met-ec.com/cdn/uc/pc/账号管理.mp4')"
                    >
                      <icon-font icon="iconpc-other_czsp1x"></icon-font>操作视频
                    </el-button>
                  </div>
                </div>
              </div>
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <icon-font icon="iconpc-other_qyzx_jsgl1x"></icon-font>
                  <!-- <i class="el-icon-check-management"></i> -->
                </div>
                <div class="account_box">
                  <div class="account_title">角色管理</div>
                  <div class="account_prompt">建立角色，设置维护角色拥有的相关权限。</div>
                  <div>
                    <el-button type="text" @click="jumpJurisdiction">
                      <icon-font icon="iconpc-other_qgl1x"></icon-font>去管理
                    </el-button>
                    <el-button
                      type="text"
                      @click="showVideo('https://m.met-ec.com/cdn/uc/pc/账号管理.mp4')"
                    >
                      <icon-font icon="iconpc-other_czsp1x"></icon-font>操作视频
                    </el-button>
                  </div>
                </div>
              </div>
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <icon-font class="iconpc-other_qyzx_yhgl1x"></icon-font>
                  <!-- <i class="el-icon-check-yonghuguanli-2"></i> -->
                </div>
                <div class="account_box">
                  <div class="account_title">用户管理</div>
                  <div class="account_prompt">添加企业员工，维护员工账号信息。</div>
                  <div>
                    <el-button type="text" @click="jumpUserManagement">
                      <icon-font icon="iconpc-other_qgl1x"></icon-font>去管理
                    </el-button>
                    <el-button
                      type="text"
                      @click="showVideo('https://m.met-ec.com/cdn/uc/pc/账号管理.mp4')"
                    >
                      <icon-font icon="iconpc-other_czsp1x"></icon-font>操作视频
                    </el-button>
                  </div>
                </div>
              </div>
            </div>
            <div class="title_box">
              <span class="title_type">
                <i class="el-icon-check-signature-setting"></i>
                <span>电子签章设置</span>
              </span>
            </div>
            <div class="profile_box profile_set_box">
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <!-- <i
                    class="el-icon-check-certified"
                    :class="{
                      'el-icon-check-certified': fddStatus === '4',
                       'el-icon-check-nocertified': fddStatus !== '4',
                     }"
                  ></i>-->
                  <i class="new-icon iconpc-other_qyzx_qydzqzrz1x"></i>
                </div>
                <div class="account_box">
                  <div class="account_title">
                    <span class="account_title_name">企业电子签章认证</span>
                    <span
                      class="account_title_icon"
                      :class="{'adopt': fddStatus === '4', 'refuse': fddStatus !== '4'}"
                    >
                      <icon-font
                        :icon="fddStatus === '4' ? `iconpc-alert_ywcrz1x`: `iconpc-alert_wrzsq1x`"
                      ></icon-font>
                      {{fddStatus === '4'? '已认证': '未认证'}}
                    </span>
                    <!-- <i
                    class="el-icon-check-certified"
                    :class="{
                      'el-icon-check-certified': fddStatus === '4',
                       'el-icon-check-nocertified': fddStatus !== '4',
                     }"
                    ></i>-->
                  </div>
                  <div class="account_prompt">开通企业电子签章，可用于业务盖章使用。</div>
                  <div>
                    <el-button type="text" @click="checkAuth" v-if="fddStatus !== '0'">
                      <icon-font icon="iconpc-other_cxrzicon1x"></icon-font>
                      {{ '重新认证' }}
                    </el-button>
                    <el-button type="text" @click="getSignatureUrl" v-if="fddStatus !== '4'">
                      <icon-font icon="iconpc-other_cxrzicon1x"></icon-font>
                      {{ fddStatus !== '0' ? '继续认证' : '去认证' }}
                    </el-button>
                    <el-button type="text" @click="showSignDialog" v-if="fddStatus === '4'">
                      <icon-font icon="iconpc-other_ylicon1x"></icon-font>
                      {{ '电子签章预览' }}
                    </el-button>
                    <el-button
                      type="text"
                      @click="showVideo('https://mt.heng-tai.com.cn/cdn/channel/电子签章企业实名认证+个人实名认证.mp4')"
                    >
                      <icon-font icon="iconpc-other_czsp1x"></icon-font>操作视频
                    </el-button>
                  </div>
                </div>
              </div>
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <!-- <i
                    class="el-icon-check-certified"
                    :class="{
                  'el-icon-check-certified': personFddStatus === '2',
                  'el-icon-check-nocertified': personFddStatus !== '2',
                }"
                  ></i>-->
                  <icon-font icon="iconpc-other_qyzx_grrz1x"></icon-font>
                </div>
                <div class="account_box">
                  <div class="account_title">
                    <span class="account_title_name">个人认证</span>
                    <span
                      class="account_title_icon"
                      :class="{'adopt': personFddStatus === '2', 'refuse': personFddStatus !== '2'}"
                    >
                      <icon-font
                        :icon="personFddStatus === '2' ? 'iconpc-alert_ywcrz1x': 'iconpc-alert_wrzsq1x'"
                      ></icon-font>
                      {{personFddStatus === '2'? '已认证': '未认证'}}
                    </span>
                  </div>
                  <div class="account_prompt">盖章操作人身份认证。</div>
                  <div>
                    <el-button
                      type="text"
                      @click="checkpersonalAuth"
                      v-if="personFddStatus !== '0'"
                    >
                      <icon-font icon="iconpc-other_cxrzicon1x"></icon-font>
                      {{ '重新认证' }}
                    </el-button>
                    <el-button
                      type="text"
                      @click="goCertificationOther"
                      v-if="personFddStatus !== '2'"
                    >
                      <icon-font icon="iconpc-other_cxrzicon1x"></icon-font>
                      {{ personFddStatus !== '0' ? '' : '去认证' }}
                    </el-button>
                    <el-button
                      type="text"
                      @click="showVideo('https://mt.heng-tai.com.cn/cdn/channel/电子签章企业实名认证+个人实名认证.mp4')"
                    >
                      <icon-font icon="iconpc-other_czsp1x"></icon-font>操作视频
                    </el-button>
                  </div>
                </div>
              </div>
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <icon-font icon="iconpc-other_qyzx_jtygqzsq1x"></icon-font>
                  <!-- <i
                    class="el-icon-check-certified"
                    :class="{
                  'el-icon-check-certified': cliqueStaffAuthStatus,
                  'el-icon-check-nocertified': !cliqueStaffAuthStatus,
                }"
                  ></i>-->
                </div>
                <div class="account_box">
                  <div class="account_title">
                    <span class="account_title_name">集团员工签章授权</span>
                    <span
                      class="account_title_icon"
                      :class="{'adopt': cliqueStaffAuthStatus, 'refuse': !cliqueStaffAuthStatus}"
                    >
                      <icon-font
                        :icon="cliqueStaffAuthStatus ? 'iconpc-alert_ywcrz1x': 'iconpc-alert_wrzsq1x'"
                      ></icon-font>
                      {{cliqueStaffAuthStatus? '已授权': '未授权'}}
                    </span>
                  </div>
                  <div class="account_prompt">对集团内非本企业员工授权使用本企业电子签章。</div>
                  <div>
                    <el-button type="text" @click="jumpGroupSignature">
                      <icon-font icon="iconpc-other_qsqicon1x"></icon-font>去授权
                    </el-button>
                    <el-button
                      type="text"
                      @click="showVideo('https://m.met-ec.com/cdn/uc/pc/电子签章管理.mp4')"
                    >
                      <icon-font icon="iconpc-other_czsp1x"></icon-font>操作视频
                    </el-button>
                  </div>
                </div>
              </div>
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <!-- <i
                    class="el-icon-check-certified"
                    :class="{
                  'el-icon-check-certified': cliqueStaffAuthStatus,
                  'el-icon-check-nocertified': !cliqueStaffAuthStatus,
                }"
                  ></i>-->
                  <icon-font icon="iconpc-other_qyzx_qyygqzsq1x"></icon-font>
                </div>
                <div class="account_box">
                  <div class="account_title">
                    <span class="account_title_name">企业员工签章授权</span>
                    <span
                      class="account_title_icon"
                      :class="{'adopt': companyStaffAuthStatus, 'refuse': !companyStaffAuthStatus}"
                    >
                      <icon-font
                        :icon="companyStaffAuthStatus ? 'iconpc-alert_ywcrz1x': 'iconpc-alert_wrzsq1x'"
                      ></icon-font>
                      {{companyStaffAuthStatus? '已授权': '未授权'}}
                    </span>
                  </div>
                  <div class="account_prompt">本对企业已个人认证员工进行企业盖章授权使用。</div>
                  <div>
                    <el-button type="text" @click="jumpSsignatureManagement">
                      <icon-font icon="iconpc-other_qsqicon1x"></icon-font>去授权
                    </el-button>
                    <el-button
                      type="text"
                      @click="showVideo('https://m.met-ec.com/cdn/uc/pc/电子签章管理.mp4')"
                    >
                      <icon-font icon="iconpc-other_czsp1x"></icon-font>操作视频
                    </el-button>
                  </div>
                </div>
              </div>
            </div>
            <div class="title_box">
              <span class="title_type">
                <!-- <i class="iconpc-menu_sjjksq1x"></i> -->
                <icon-font icon="iconpc-other_qyzx_sjgl1x"></icon-font>
                <span>数据管理</span>
              </span>
            </div>
            <div class="profile_box profile_set_box">
              <div class="account_profile_box_item">
                <div class="icon_box">
                  <icon-font icon="iconpc-menu_sjjksq1x"></icon-font>
                </div>
                <div class="account_box">
                  <div class="account_title">数据管理</div>
                  <div class="account_prompt">用于数据管理授权</div>
                  <div>
                    <el-button type="text" @click="jumpDataManagement">
                      <icon-font icon="iconpc-other_qgl1x"></icon-font>去管理
                    </el-button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </el-main>
    </el-container>

    <!-- 修改密码 -->
    <el-dialog
      class="dialog-password"
      :title="activeTitle"
      width="500px"
      :before-close="dialogClose"
      :visible.sync="detailVisible"
    >
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="通过密码验证修改" name="first">
          <el-form
            :model="pass"
            :rules="rules"
            label-position="right"
            label-width="132px"
            ref="ruleForm"
          >
            <el-form-item prop="userName" label="用户名">
              <el-input
                maxlength="20"
                placeholder="用户名"
                v-model="pass.userName"
                type="text"
                :disabled="true"
                clearable
              />
            </el-form-item>
            <el-form-item prop="oldPassword" label="原密码">
              <el-input
                maxlength="16"
                placeholder="请输入原密码"
                v-model="pass.oldPassword"
                autocomplete="new-password"
                type="password"
                clearable
                show-password
              />
            </el-form-item>
            <el-form-item prop="newPassword" label="新密码">
              <el-input
                placeholder="请输入新密码"
                maxlength="16"
                v-model="pass.newPassword"
                autocomplete="new-password"
                type="password"
                clearable
                show-password
              />
            </el-form-item>
            <el-form-item prop="newPasswordSecond" label="确认密码">
              <el-input
                placeholder="确认密码"
                maxlength="16"
                type="password"
                v-model="pass.newPasswordSecond"
                autocomplete="new-password"
                clearable
              />
            </el-form-item>
          </el-form>
          <div class="foot">
            <el-button type="primary" class="submit" @keyup="submit" @click="submit">提交</el-button>
            <el-button class="submit" @keyup="reset" @click="resetPwdForm">重置</el-button>
          </div>
        </el-tab-pane>
        <el-tab-pane label="通过手机验证修改" name="second">
          <el-form
            :model="phoneCode"
            :rules="PhoneRules"
            label-position="right"
            label-width="132px"
            ref="phoneForm"
          >
            <el-form-item prop="loginName" label="用户名">
              <el-input
                type="text"
                v-model="phoneCode.loginName"
                placeholder="请输入用户名"
                autocomplete="new-password"
                :disabled="true"
                clearable
              />
            </el-form-item>
            <el-form-item prop="password" label="新密码">
              <el-input
                maxlength="20"
                placeholder="请输入新密码"
                v-model="phoneCode.password"
                type="password"
                autocomplete="new-password"
                clearable
                show-password
              />
            </el-form-item>
            <el-form-item prop="passwordSecond" label="确认密码">
              <el-input
                maxlength="16"
                placeholder="确认密码"
                v-model="phoneCode.passwordSecond"
                autocomplete="new-password"
                type="password"
                clearable
                show-password
              />
            </el-form-item>
            <!-- <el-form-item prop="phone" label="手机号">
              <el-input
                placeholder="手机号"
                maxlength="16"
                v-model="phoneCode.phone"
                autocomplete="new-password"
                type="password"
                clearable
              />
            </el-form-item>-->
            <el-form-item prop="code" label="手机短信验证码" class="pCode">
              <el-input
                placeholder="手机短信验证码"
                maxlength="16"
                type="text"
                v-model="phoneCode.code"
                autocomplete="new-password"
                clearable
              />
              <el-button
                class="getCode"
                @click="sendCode"
                type="primary"
                :loading="codeLoading"
                :disabled="sendCodeDiabled"
                maxlength="6"
              >{{ sendCodeTitle }}</el-button>
            </el-form-item>
          </el-form>
          <div class="foot">
            <el-button type="primary" class="submit" @keyup="phoneSubmit" @click="phoneSubmit">提交</el-button>
            <el-button class="submit" @keyup="reset" @click="resetPhoneForm">重置</el-button>
          </div>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
    <!-- 用户信息 -->
    <el-dialog
      title="个人中心"
      :visible.sync="userInfoVisible"
      class="person-dialog-box"
      width="960px"
      top="10vh"
      @close="resetUserInfoForm"
    >
      <div class="title_list">
        <div
          v-for="(item, index) in titleList"
          :key="index"
          :class="{activeDiv: index === titleNumber}"
          @click="titleTab(index)"
        >
          {{ item.title }}
          <span class="activeBorder" v-show="index === titleNumber"></span>
        </div>
      </div>
      <main>
        <div class="userContent" v-show="titleNumber === 0">
          <el-form
            ref="userInfoForm"
            :model="userInfoForm"
            inline
            label-width="80px"
            :rules="userInfoFormRules"
            label-position="top"
          >
            <div class="userName">
              用户名
              <span>{{ userInfoForm.loginName }}</span>
            </div>
            <el-form-item label="手机号" prop="phone">
              <el-input
                v-model="userInfoForm.phone"
                placeholder="请输入"
                clearable
                maxlength="11"
                :width="387"
              />
            </el-form-item>
            <el-form-item label="邮箱" prop="mail">
              <el-input v-model="userInfoForm.mail" placeholder="请输入" maxlength="30" />
            </el-form-item>
            <el-form-item label="姓名" prop="userName">
              <el-input v-model="userInfoForm.userName" placeholder="请输入" clearable maxlength="16" />
            </el-form-item>
            <el-form-item label="性别" prop="gender">
              <el-select v-model="userInfoForm.gender" placeholder="请选择">
                <el-option
                  v-for="item in gender"
                  :key="item.val"
                  :label="item.lab"
                  :value="item.val"
                />
              </el-select>
            </el-form-item>
          </el-form>
          <div v-show="titleNumber === 0"></div>
        </div>
        <div class="userContent" v-show="titleNumber === 1">
          <el-form
            ref="identityInfoForm"
            :model="identityInfoForm"
            inline
            label-width="80px"
            :rules="identityInfoFormRules"
            label-position="top"
            :disabled="editDisable"
          >
            <div class="userName">
              <div>
                姓名
                <span>{{ userInfoForm.userName }}</span>
              </div>
              <div>
                性别
                <span>{{ userInfoForm.genderStr }}</span>
              </div>
            </div>
            <el-form-item label="民族" prop="nation">
              <el-input
                v-model="identityInfoForm.nation"
                placeholder="请输入"
                clearable
                maxlength="11"
                :width="387"
              />
            </el-form-item>
            <el-form-item label="出生日期" prop="birth">
              <el-input v-model="identityInfoForm.birth" placeholder="请输入" maxlength="30" />
            </el-form-item>
            <el-form-item label="身份证号" prop="idNumber">
              <el-input v-model="identityInfoForm.idNumber" placeholder="请输入" maxlength="30" />
            </el-form-item>
            <el-form-item label="住址" prop="address">
              <el-input v-model="identityInfoForm.address" placeholder="请输入" maxlength="99" />
            </el-form-item>
            <el-form-item label="签发机关" prop="issuingAuthority">
              <el-input
                v-model="identityInfoForm.issuingAuthority"
                placeholder="请输入"
                clearable
                maxlength="16"
              />
            </el-form-item>
            <el-form-item label="有效期" prop="expiryDate">
              <el-input
                v-if="btnNumber === 0"
                v-model="expiryDateForm"
                placeholder="请输入"
                clearable
                maxlength="16"
              />
              <el-date-picker
                v-else
                v-model="identityInfoForm.expiryDate"
                type="daterange"
                value-format="yyyy-MM-dd"
                start-placeholder="开始日期"
                end-placeholder="结束日期"
              ></el-date-picker>
              <!-- value-format="yyyy-MM-dd" -->
            </el-form-item>
            <el-form-item label="身份证照片" prop="userName">
              <div class="photo_box">
                <!-- 我是正面 1 -->
                <PictureUpload
                  :imgStr1="identityInfoForm.idPhoto[0]"
                  @RequestUpload="uploadSuccessaaa"
                  :Identificationone="Identificationones"
                ></PictureUpload>
                <!-- 我是反面 2-->
                <PictureUpload
                  :imgStr2="identityInfoForm.idPhoto[1]"
                  @RequestUpload="uploadSuccessaaa"
                  :Identificationtwo="Identificationtwos"
                ></PictureUpload>
              </div>
            </el-form-item>
          </el-form>
        </div>
        <div class="userContent" v-show="titleNumber === 2">
          认证状态： {{ personIfCertification ? '已认证' : '未认证' }}
          <el-button type="text" v-if="!personIfCertification" @click="goCertification">去认证</el-button>
        </div>
      </main>
      <div slot="footer" class="dialog-footer">
        <el-button
          v-if="titleNumber === 0"
          type="primary"
          @click.stop="updateUserInfo"
          :loading="userInfoLoading"
        >确定</el-button>
        <el-button type="primary" v-if="titleNumber === 2" @click="closeCertification">确定</el-button>
        <div ref="operation_switching" class="operation_switching" v-if="titleNumber === 1">
          <el-button
            type="primary"
            @click.stop="btnNumber === 0 ? editEvent() : identityInformation()"
            :loading="userInfoLoading"
          >{{ btnNumber === 0 ? '编辑' : '确定' }}</el-button>
        </div>
      </div>
    </el-dialog>
    <CertificationComfirmDialog ref="certification" @update="queryPersonalCertification"></CertificationComfirmDialog>

    <el-dialog title="提示" :visible.sync="showDialog" width="30%">
      <h1 class="text">重新认证确认</h1>

      <span>
        {{
        '企业认证' + this.cnfddStatus + '，是否确认进行重新认证？'
        }}
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handleClose">取 消</el-button>
        <el-button type="primary" @click="recertification">确 定</el-button>
      </span>
    </el-dialog>

    <el-dialog title="提示" :visible.sync="showPersonalDialog" width="30%">
      <h1 class="text">重新认证确认</h1>

      <span>
        {{
        '个人认证' + this.cnpersonFddStatus + '，是否确认进行重新认证？'
        }}
      </span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="handlePersonalClose">取 消</el-button>
        <el-button type="primary" @click="personalRecertification">确 定</el-button>
      </span>
    </el-dialog>

    <el-dialog
      title="操作视频"
      :visible.sync="showVideoDialog"
      :before-close="handleVideoClose"
      width="400"
    >
      <!-- <h1 class="text">操作视频</h1> -->
      <video ref="videoItem" :src="videoUrl" controls="controls" width="100%"></video>
    </el-dialog>

    <el-dialog title="提示" :visible.sync="enterpriseDialog" width="30%">
      <h1 class="text">已发起企业认证，是否获取最新状态？</h1>

      <span>{{ '发起企业认证之后，需要刷新页面，获取最新页面' }}</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="refreshStatus">取 消</el-button>
        <el-button type="primary" @click="refreshStatus">确 定</el-button>
      </span>
    </el-dialog>

    <el-dialog title="电子签章预览" :visible.sync="showPicDialog" width="30%">
      <span>{{ '企业电子签章名称: ' + this.sealName }}</span>
      <div class="image-div">
        <el-image :src="showPicUrl">
          <div slot="placeholder">
            加载中
            <span class="dot">...</span>
          </div>
        </el-image>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dismissPicDialog">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {mapState} from 'vuex'
import auth from '@mixins/auth'
import {$loadFileSimply} from '@const/loadFileOps'

import {
  getCurrentApps,
  chooseApps,
  UcMerchantUserGetById,
  updateUserPassword,
  UcMerchantUserUpdate,
  orderBackUcMerchantIdentityUsergetById,
  orderBackUcMerchantIdentityUserupdate,
  sendVerificationCodeByLoginName,
  updatePasswordByPhone,
} from '@const/api_staffCenter.js'
import {getCompanyInfo} from '@const/api_authCenter.js'
import {openElectronicSignature} from '@const/api.js'
import {
  companyRepeatCertification,
  personalRepeatCertification,
} from '@const/api_interface.js'
import {
  username,
  realName,
  password,
  phone,
  email,
  checkIdCard,
} from '@const/formValidate.js'
import md5 from 'js-md5'
import {hasIn} from 'lodash'
import PictureUpload from '@components/pictureUpload'
import CertificationComfirmDialog from '@/moduleComponents/certification-confirm-dialog'
import cookie from 'js-cookie'
import {
  fddWebQueryPersonalCertification,
  fddWebApplyPersonalCertification,
  getCompanySealName,
  getCompanySealStream,
} from '@const/api_interfaceCenter'
const TIME_COUNT = 60
export default {
  mixins: [auth],
  layout: 'blank',
  components: {PictureUpload, CertificationComfirmDialog},
  data() {
    var validatePass = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入原密码'))
      } else {
        callback()
      }
    }
    var validatePassUserName = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入用户名'))
      } else {
        callback()
      }
    }
    var validatePhone = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入手机号'))
      } else {
        callback()
      }
    }
    var validatePhoneCode = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入手机短信验证码'))
      } else {
        callback()
      }
    }
    var validateNewPass = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入新密码'))
      } else if (value === this.pass.oldPassword) {
        callback(new Error('不能与原密码相同'))
      } else {
        callback()
      }
    }
    var validatePassSecond = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请再次输入新密码'))
      } else if (value !== this.pass.newPassword) {
        callback(new Error('两次输入密码不一致!'))
      } else {
        callback()
      }
    }
    var validatePhoneCodeSecond = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请再次输入新密码'))
      } else if (value !== this.phoneCode.password) {
        callback(new Error('两次输入密码不一致!'))
      } else {
        callback()
      }
    }
    let checkUserName = [{validator: validatePassUserName, trigger: 'blur'}]
    let checkPhone = [{validator: validatePhone, trigger: 'blur'}]
    let checkCode = [{validator: validatePhoneCode, trigger: 'blur'}]
    let check = [
      {validator: validatePass, trigger: 'blur'},
      {pattern: /^[0-9a-zA-Z]{6,16}$/, message: '密码为6-16位数字或字母'},
    ]
    let checkNewPass = [
      {validator: validateNewPass, trigger: 'blur'},
      {pattern: /^[0-9a-zA-Z]{6,16}$/, message: '密码为6-16位数字或字母'},
    ]
    return {
      active_logo: require('@assets/img/login/pc-caise-logo.png'),
      Identificationones: '1',
      Identificationtwos: '2',
      prodata: {},
      activeTitle: '修改密码',
      detailVisible: false, // 修改密码弹框
      userInfoLoading: false,
      userInfoVisible: false, // 个人信息弹框
      gender: [
        {lab: '男', val: 1},
        {lab: '女', val: 2},
      ],
      phoneCode: {
        loginName: cookie.get('userName'),
        password: '',
        passwordSecond: '',
        phone: '',
        code: '',
      },
      PhoneRules: {
        loginName: checkUserName,
        password: checkNewPass,
        passwordSecond: [{validator: validatePhoneCodeSecond, trigger: 'blur'}],
        phone: checkPhone,
        code: checkCode,
      },
      pass: {
        userName: cookie.get('userName'),
        oldPassword: '',
        newPassword: '',
        newPasswordSecond: '',
      },
      rules: {
        userName: checkUserName,
        oldPassword: check,
        newPassword: checkNewPass,
        newPasswordSecond: [{validator: validatePassSecond, trigger: 'blur'}],
      },
      // 个人信息验证规则
      userInfoFormRules: {
        loginName: [{required: true, message: '请输入用户名', trigger: 'blur'}],
        userName: realName(),
        // password: password(),
        phone: phone(),
        mail: email(),
        gender: [{required: true, message: '请选择性别', trigger: 'change'}],
      },
      // 个人信息表单内容
      userInfoForm: {
        loginName: '呀呀呀',
        password: '',
        userName: '',
        phone: '',
        gender: '',
        genderStr: '',
        mail: '',
        idCard: '',
      },
      // 完善身份信息规则
      identityInfoFormRules: {
        nation: [{required: true, message: '请输入民族'}],
        birth: [{required: true, message: '请输入出生日期'}],
        idNumber: [
          {
            required: true,
            pattern: /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/,
            message: '你的身份证格式不正确',
          },
        ],
        address: [{required: true, message: '请输入住址'}],
        issuingAuthority: [{required: true, message: '请输入身份证签发机关'}],
        expiryDate: [{required: true, message: '请选择身份证有效期限'}],
        idPhoto: [{required: true, message: '请上传照片'}],
      },
      expiryDateForm: '',
      // 完善身份信息表单
      identityInfoForm: {
        nation: '汉族', // 民族
        birth: '1993-01-01', // 出生
        idNumber: '353535353535353535', //身份证
        address: '北京市朝阳区', //住址
        issuingAuthority: '浙江省杭州市', //签发机关
        expiryDate: ['', ''], // 有效期限
        idPhoto: ['', ''], // 身份证照片
      },
      allPageLoading: false, // 页面loading
      sysGroups: [], // 系统列表
      // 个人信息tab
      titleList: [
        {title: '修改个人信息', val: 1},
        {title: '完善身份证信息', val: 2},
        {title: '电子签章认证', val: 3},
      ],
      // tab样式判断
      titleNumber: 0,
      // btnText: '编辑',
      btnNumber: 0,
      // 编辑禁用
      editDisable: true,
      positionInfo: '',
      activeName: 'first',
      sendCodeTitle: '验证码',
      codeLoading: false,
      sendCodeDiabled: false,
      personIfCertification: false, // 是否个人认证完成
      unifiedSocialCreditCode: '', //社会统一信用代码
      fddStatus: '', //认证状态
      cnfddStatus: '', // 认证状态cn
      personFddStatus: '', //个人认证状态 "未激活", 0,"未认证","审核通过","已提交待审核", 3,"审核不通过", 4;
      cnpersonFddStatus: '',
      cliqueStaffAuthStatus: false, // 集团员工签章是否授权
      companyStaffAuthStatus: false, // 公司员工签章是否授权
      videoUrl:
        'https://mt.heng-tai.com.cn/cdn/channel/电子签章企业实名认证+个人实名认证.mp4',
      showVideoDialog: false,
      enterpriseDialog: false,
      showDialog: false,
      showPersonalDialog: false,
      showPicDialog: false,
      showPicUrl: '',
      sealName: '',
    }
  },
  mounted() {
    console.log(this.positionId, 'positionId')
    // 获取系统列表
    this.getSysList()
    let msg = this.$route.query.msg
    msg && this.$message({type: 'warning', message: decodeURIComponent(msg)})
    msg && (window.location.hash = '')
    this.$store.dispatch('getPositionList')
    this.getCompanyInfo()
  },
  computed: {
    ...mapState([
      'positionCompanyName',
      'companyName',
      'positionName',
      'positionList',
      'positionId',
    ]),
    showCompanyCode() {
      let companyCode = this.$store.state.companyCode
      return companyCode && companyCode !== 'null'
    },
    // 计算多个公司的展示
    customCompanyName() {
      return this.$store.state.companyName !== 'null'
        ? this.$store.state.companyName || '平台管理员'
        : '平台管理员'
    },
  },
  watch: {
    companyName: {
      handler: function (val, oldVal) {
        this.positionInfo = val
      },
      deep: true,
    },
  },
  methods: {
    goEditEnterprise() {
      this.$router.push(
        '/company/info-manage/enterprise-info?basic=1&defaulttype=COMPANY_MANAGE_BASIC'
      )
    },
    $loadFileSimply,
    loadFileSimplyByUrl(fileUrl, fileName = '') {
      if (!fileUrl)
        this.$message({
          type: 'warning',
          message: '文件资源丢失，请联系管理员！',
        })
      let param = {
        method: 'get',
        url: fileUrl,
        timeout: 30000,
      }
      $loadFileSimply(param).then((res) => {
        // 文件流
        console.log('imageUrl:', URL.createObjectURL(new Blob([res])))
        this.showPicUrl = URL.createObjectURL(new Blob([res]))
      })
    },
    showSignDialog() {
      this.showPicDialog = true
      this.getPicName()
      this.loadFileSimplyByUrl(getCompanySealStream)
    },
    dismissPicDialog() {
      this.showPicDialog = false
    },
    getPicName() {
      this.$axios({
        method: 'get',
        url: getCompanySealName,
      }).then((res) => {
        if (res.data.code === '0') {
          let obj = hasIn(res, 'data.payload') ? res.data.payload : {}
          if (obj.sealName) {
            console.log(obj.sealName, 'obj.sealName')
            this.sealName = obj.sealName
          }
        } else {
          this.$message.error(data.msg)
        }
      })
    },
    //获取公司信息认证状态
    getCompanyInfo() {
      this.$axios({
        method: 'get',
        url: getCompanyInfo,
      }).then((res) => {
        if (res.data.code === '0') {
          let obj = hasIn(res, 'data.payload') ? res.data.payload : {}
          if (obj) {
            this.unifiedSocialCreditCode = obj.unifiedSocialCreditCode
            this.fddStatus = obj.companyFddStatus
            this.personFddStatus =
              obj.personFddStatus !== 'null' ? obj.personFddStatus : '0'
            this.cliqueStaffAuthStatus = obj.cliqueStaffAuthStatus
            this.companyStaffAuthStatus = obj.companyStaffAuthStatus
            if (obj.companyFddStatus === '0') {
              this.cnfddStatus = '未认证'
            } else if (obj.companyFddStatus === '1') {
              this.cnfddStatus = '管理员资料已提交'
            } else if (obj.companyFddStatus === '2') {
              this.cnfddStatus = '企业基本资料(没有申请表)已提交'
            } else if (obj.companyFddStatus === '3') {
              this.cnfddStatus = '已提交待审核'
            } else if (obj.companyFddStatus === '4') {
              this.cnfddStatus = '审核通过'
            } else if (obj.companyFddStatus === '5') {
              this.cnfddStatus = '审核不通过'
            } else if (obj.companyFddStatus === '6') {
              this.cnfddStatus = '人工初审通过'
            }

            if (obj.personFddStatus === '0') {
              this.cnpersonFddStatus = '未激活'
            } else if (obj.personFddStatus === '1') {
              this.cnpersonFddStatus = '未认证'
            } else if (obj.personFddStatus === '2') {
              this.cnpersonFddStatus = '审核通过'
            } else if (obj.personFddStatus === '3') {
              this.cnpersonFddStatus = '已提交待审核'
            } else if (obj.personFddStatus === '4') {
              this.cnpersonFddStatus = '审核不通过'
            }
          }
          console.log(obj, 'obj')
        }
      })
    },
    //跳转到组织管理页面
    jumpOrgainzationManagement() {
      this.$router.push({
        path:
          '/systemSetup/orgainzationManagement?basic=1&defaulttype=ACCOUNT_MANAGE_BASIC',
      })
    },
    //跳转到角色管理页面
    jumpJurisdiction() {
      this.$router.push({
        path:
          '/systemSetup/jurisdiction?basic=1&defaulttype=ACCOUNT_MANAGE_BASIC',
      })
    },
    //跳转到用户管理页面
    jumpUserManagement() {
      this.$router.push({
        path:
          '/systemSetup/userManagement?basic=1&defaulttype=ACCOUNT_MANAGE_BASIC',
      })
    },
    //集团签章人授权管理
    jumpGroupSignature() {
      this.$router.push({
        path:
          '/systemSetup/signatureManagement/groupSignature?basic=1&defaulttype=E_SIGNATURE_BASIC',
      })
    },
    //企业员工签章授权
    jumpSsignatureManagement() {
      this.$router.push({
        path:
          '/systemSetup/signatureManagement?basic=1&defaulttype=E_SIGNATURE_BASIC',
      })
    },
    jumpDataManagement() {
      this.$router.push({path: '/systemSetup/dataManagement'})
    },
    showVideo(url) {
      this.videoUrl = url
      this.showVideoDialog = true
    },
    handleVideoClose() {
      this.showVideoDialog = false
      this.$refs.videoItem.pause()
    },
    refreshStatus() {
      this.enterpriseDialog = false
      this.getCompanyInfo()
    },
    showEnterpriseDialog() {
      this.enterpriseDialog = true
    },
    //企业电子签章、去认证/重新认证
    recertification() {
      this.$axios({
        method: 'get',
        url: companyRepeatCertification,
      })
        .then((res) => {
          if (res.data.code === '0') {
            let obj = hasIn(res, 'data.payload') ? res.data.payload : {}
            if (obj.fddUrl) {
              window.open(obj.fddUrl, '_blank')
            }
          } else {
            this.$message.error(data.msg)
          }
        })
        .finally(() => {
          this.showDialog = false
        })
    },
    //个人电子签章重新认证
    personalRecertification() {
      this.$axios
        .$get(personalRepeatCertification)
        .then((res) => {
          if (res.code === '0') {
            let obj = hasIn(res, 'payload') ? res.payload : {}
            if (obj.fddUrl) {
              window.open(obj.fddUrl, '_blank')
            }
          } else {
            this.$message.error(res.msg)
          }
        })
        .finally(() => {
          this.showPersonalDialog = false
        })
    },
    // 获取开通电子签章的地址
    getSignatureUrl() {
      this.$axios({
        url: openElectronicSignature,
        method: 'get',
      })
        .then(({data}) => {
          if (data.payload) {
            window.open(data.payload)
          } else {
            this.$message({
              type: 'warning',
              message: '获取认证地址失败请联系管理员',
            })
          }
        })
        .finally((res) => {
          this.enterpriseDialog = true
        })
    },
    // 个人认证申请
    goCertificationOther() {
      this.$axios.get(fddWebApplyPersonalCertification).then((res) => {
        const {data} = res
        if (!Number(data.code)) {
          const payload = data.payload
          const applyPersonUrl = payload.fddUrl
          window.open(applyPersonUrl, '_blank')
        } else {
          this.$message.error(data.msg)
        }
      })
    },
    handleClose() {
      this.showDialog = false
    },
    handlePersonalClose() {
      this.showPersonalDialog = false
    },
    //验证检测
    checkAuth() {
      if (this.fddStatus === '0') {
        this.recertification()
      } else {
        this.showDialog = true
      }
    },
    //验证检测
    checkpersonalAuth() {
      if (this.personFddStatus === '0') {
        this.personalRecertification()
      } else {
        this.showPersonalDialog = true
      }
    },
    // 个人认证申请
    goCertification() {
      this.$axios.get(fddWebApplyPersonalCertification).then((res) => {
        const {data} = res
        if (!Number(data.code)) {
          const payload = data.payload
          const applyPersonUrl = payload.fddUrl
          this.$refs.certification.dialogVisible = true
          window.open(applyPersonUrl, '_blank')
        } else {
          this.$message.error(data.msg)
        }
      })
    },
    // 电子签章 个人认证查询
    async queryPersonalCertification() {
      const personInfo = await this.$axios.get(fddWebQueryPersonalCertification)
      this.personIfCertification = hasIn(personInfo, [
        'data',
        'payload',
        'ifCertification',
      ])
        ? personInfo.data.payload.ifCertification
        : false
    },
    // 关闭认证
    closeCertification() {
      this.userInfoVisible = false
    },
    // 更新个人信息
    updateUserInfo() {
      this.$refs['userInfoForm'].validate((valid) => {
        if (valid) {
          this.$axios({
            method: 'post',
            url: UcMerchantUserUpdate,
            data: {
              id: this.$store.state.userId,
              gender: this.userInfoForm.gender,
              genderStr:
                this.userInfoForm.genderStr === null
                  ? '--'
                  : this.userInfoForm.genderStr,
              loginName: this.userInfoForm.loginName,
              mail: this.userInfoForm.mail,
              phone: this.userInfoForm.phone,
              userName: this.userInfoForm.userName,
            },
          }).then((res) => {
            if (res.data.code === '0') {
              this.$message({type: 'success', message: '修改成功!'})
              this.userInfoVisible = false
            }
          })
        }
      })
    },
    // 获取个人信息
    getUserInfo() {
      this.userInfoVisible = true
      ;(this.titleNumber = 0),
        (this.btnNumber = 0),
        // 编辑禁用
        (this.editDisable = true)
      this.$axios({
        method: 'get',
        url: UcMerchantUserGetById,
        params: {
          id: this.$store.state.userId,
        },
      }).then((res) => {
        if (res.data.code === '0') {
          let obj = hasIn(res, 'data.payload') ? res.data.payload : {}
          this.userInfoForm = obj
        }
      })
    },
    // 重置个人信息
    resetUserInfoForm() {},
    getSysList() {
      console.log('==============getSysList============')
      this.allPageLoading = true
      this.$axios({
        url: getCurrentApps,
        method: 'post',
        data: {},
      })
        .then((res) => {
          if (res.data.code === '0') {
            let arr = hasIn(res, ['data', 'payload']) ? res.data.payload : []
            this.sysGroups = arr
            this.allPageLoading = false
            this.judgeLen(arr)
          }
        })
        .catch(() => {
          this.handleDropdown('logout')
          this.allPageLoading = false
        })
    },
    // 完善身份信息编辑
    editEvent() {
      this.btnNumber = 1
      this.editDisable = false
    },
    uploadSuccessaaa(url, nnns) {
      if (nnns === '1') {
        this.identityInfoForm.idPhoto[0] = url // 身份证照片正面
      } else {
        this.identityInfoForm.idPhoto[1] = url // 有效期限片反面
      }
    },
    // orderBackUcMerchantIdentityUsergetById 获取身份证信息
    cardinformation() {
      this.$axios({
        method: 'get',
        url: `${orderBackUcMerchantIdentityUsergetById}?userId=${this.$store.state.userId}`,
        data: {
          userId: this.$store.state.userId,
        },
      }).then((res) => {
        if (res.data.code !== '0') return
        let temporary = res.data.payload
        this.identityInfoForm.userName = temporary.name
        this.identityInfoForm.genderStr = temporary.genderStr
        this.identityInfoForm.nation = temporary.nation
        this.identityInfoForm.birth = temporary.birthDate
        this.identityInfoForm.idNumber = temporary.identityId
        this.identityInfoForm.address = temporary.address
        this.identityInfoForm.issuingAuthority = temporary.issueOffice
        this.identityInfoForm.expiryDate[0] =
          temporary.startDate === null ? '' : temporary.startDate //开始时间 还需改动
        this.identityInfoForm.expiryDate[1] =
          temporary.endDate === null ? '' : temporary.endDate //结束时间
        this.identityInfoForm.idPhoto[0] = temporary.identityFront //身份正面
        this.identityInfoForm.idPhoto[1] = temporary.identityBack //身份证反面
        if (temporary.startDate) {
          this.expiryDateForm =
            temporary.startDate.split(' ')[0] +
            '-' +
            temporary.endDate.split(' ')[0]
        } else {
          this.expiryDateForm = ''
        }
      })
    },
    // 完善身份信息更新  orderBackUcMerchantIdentityUserupdate  根据用户ID修改身份证信息 接口
    identityInformation() {
      // 需要添加正则判断  不改变时间是 2020-03-10 16:00:00  重新选择时间是 Wed Mar 18 2020 00:00:00 GMT+0800 (中国标准时间)  判断是不是以数字开头的 如果是则用模板字符串进行拼接 如果不是则不改变直接入参
      if (
        !(this.identityInfoForm.idPhoto[0] && this.identityInfoForm.idPhoto[1])
      ) {
        this.$message({
          type: 'warning',
          message: '请上传身份证照片',
        })
        return
      }
      this.$refs['identityInfoForm'].validate((valid) => {
        if (valid) {
          let verificationTimestart = `${
            this.identityInfoForm.expiryDate[0].split(' ')[0]
          } 16:00:00`
          let verificationTimeend = `${
            this.identityInfoForm.expiryDate[1].split(' ')[0]
          } 16:00:00`
          if (!(verificationTimestart && verificationTimeend)) {
            this.$message({
              type: 'warning',
              message: '请输入有效期',
            })
            return
          }
          this.prodata.userId = this.$store.state.userId
          this.prodata.nation = this.identityInfoForm.nation // 民族
          this.prodata.birthDate = this.identityInfoForm.birth // 出生
          this.prodata.identityId = this.identityInfoForm.idNumber // 身份证
          this.prodata.address = this.identityInfoForm.address // 住址
          this.prodata.issueOffice = this.identityInfoForm.issuingAuthority // 签发机关
          this.prodata.startDate = verificationTimestart // 有效期限
          this.prodata.endDate = verificationTimeend // 有效期限
          this.prodata.identityFront = this.identityInfoForm.idPhoto[0] // 正面
          this.prodata.identityBack = this.identityInfoForm.idPhoto[1] // 反面
          this.prodata.gender = this.userInfoForm.gender // 性别
          this.prodata.name = this.userInfoForm.userName // 姓名
          // 请求
          this.$axios({
            method: 'post',
            url: orderBackUcMerchantIdentityUserupdate,
            data: this.prodata,
          }).then((res) => {
            this.userInfoVisible = false
            this.$message({
              type: 'success',
              message: '上传成功',
              duration: 1000,
            })
          })
        }
      })
    },
    // 判断长度是否大一一个
    judgeLen(arr) {
      if (!arr || !arr.length) {
        window.location.href = '/business/index'
        this.showMessage('暂无分配系统，请联系管理员！')
      } else {
        // if (
        //   arr.length === 1 &&
        //   arr[0].appListInsts &&
        //   arr[0].appListInsts.length === 1
        // ) {
        //   this.showMessage('检测到只有一个系统，自动进入该系统！')
        //   let timer = setTimeout(() => {
        //     this.toSystem(arr[0].appListInsts[0])
        //   }, 1000)
        // }
      }
    },
    showMessage(msg, type = 'warning') {
      this.$message({
        type: type,
        message: msg,
      })
    },
    handleDropdown(command) {
      if (command === 'logout') {
        this.$store.commit(command)
        this.$router.replace(this.$PATH_CONST.login_page)
      } else if (command === 'putPass') {
        this.detailVisible = true
      } else if (command === 'userInfo') {
        // this.getUserInfo()
        // this.cardinformation()
        this.$router.push('/systemSetup/personal')
      } else if (command === 'enterPriseCenter') {
        this.toEnterpriseCenter()
      }
    },
    handleClick(tab, event) {
      console.log(tab, event)
    },
    reset() {
      console.log('tab, event')
    },
    // 短信验证码确定
    phoneSubmit() {
      this.$refs['phoneForm'].validate((valid) => {
        if (valid) {
          let data = {
            loginName: this.phoneCode.loginName,
            newPassword: md5(this.phoneCode.passwordSecond),
            // phone: this.phoneCode.phone,
            verificationCode: this.phoneCode.code,
          }
          this.submitLoading = true
          this.$axios({
            url: updatePasswordByPhone,
            method: 'post',
            data,
          })
            .then((res) => {
              this.$message({type: 'success', message: '密码修改成功'})
              this.$router.push(this.$PATH_CONST.login_page)
            })
            .finally((res) => {
              this.submitLoading = false
            })
        }
      })
    },
    resetPhoneForm() {
      this.$refs['phoneForm'].resetFields()
    },
    resetPwdForm() {
      this.$refs['ruleForm'].resetFields()
    },
    // 确定按钮
    submit() {
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          let data = {
            id: this.$store.state.userId,
            password: md5(this.pass.oldPassword),
            newPassword: md5(this.pass.newPassword),
          }
          this.submitLoading = true
          this.$axios({
            url: updateUserPassword,
            method: 'post',
            data,
          })
            .then((res) => {
              this.$message({type: 'success', message: '密码修改成功'})
              this.$router.replace(this.$PATH_CONST.login_page)
              this.detailVisible = false
              this.onClear()
            })
            .finally((res) => {
              this.submitLoading = false
            })
        }
      })
    },
    // 清空数据
    onClear() {
      this.pass = {
        oldPassword: '',
        newPassword: '',
        newPasswordSecond: '',
      }
    },
    dialogClose() {
      this.onClear()
      this.detailVisible = false
    },
    sendCode() {
      // if (!this.ruleForm.phone) {
      //   this.$message({type: 'warning', message: '请先输入手机号码'})
      //   return
      // }
      // this.ruleForm.phone = '17319299097'
      this.codeLoading = true
      this.$axios({
        method: 'post',
        url: sendVerificationCodeByLoginName,
        data: {
          loginName: this.phoneCode.loginName,
          // prefix: this.prefix
        },
      })
        .then((data) => {
          if (data.data.code * 1 === 0) {
            this.$message({
              message: `验证码已下发到您尾号${data.data.payload}的手机号，请注意查收`,
              type: 'success',
            })
            // this.ruleForm.phone = data.data.payload
            this.countDown()
          }
        })
        .finally(() => {
          this.codeLoading = false
        })
    },
    countDown() {
      if (this.sendCodeDiabled) return
      this.sendCodeDiabled = true
      this.count = TIME_COUNT
      let timer = setInterval(() => {
        if (this.count > 0 && this.count <= TIME_COUNT) {
          this.count--
          this.sendCodeTitle = `${this.count}秒后重新获取`
        } else {
          this.sendCodeTitle = '重新获取'
          this.timer = null
          this.sendCodeDiabled = false
          clearInterval(timer)
        }
      }, 1000)
    },
    titleTab(ind) {
      this.titleNumber = ind
      // 个人签章认证状态查询
      if (ind === 2 && !this.personIfCertification) {
        this.queryPersonalCertification()
      }
    },
    // 切换岗位
    choosePosition(val) {
      if (this.positionId === val) {
        this.$message.error('当前已是该岗位')
        return false
      }
      let item = {
        positionId: val,
      }
      this.$store.dispatch('choosePosition', {item})
    },
    toEnterpriseCenter() {
      this.$router.push({path: '/enterpriseCenter'})
    },
  },
}
</script>
<style lang="less">
@import '../m-front-common/pc/assets/var.less';
.enterprise-center-page {
  height: 100%;
  background-color: #f4f6fb;

  .el-header {
    padding: 0 48px;
    background-color: #fff;
    .logo-box {
      display: flex;
      align-items: center;
      .nav-logo {
        font-size: 45px;
        color: @themeBlue;
        vertical-align: middle;
      }
      .logo-name {
        height: 50px;
        background-color: #fff;
        font-size: 22px;
        color: @themeBlue;
        font-weight: bold;
        cursor: default;
        display: flex;
        align-items: center;
      }
    }
    .user-info {
      text-align: right;
      height: 60px;
      display: flex;
      align-items: center;
      justify-content: flex-end;

      .el-input__inner {
        border: none;
      }
      .position {
        display: flex;
        align-items: center;
        margin-right: 15px;
        .positionInfo {
          display: flex;
          flex-direction: column;
        }
      }
      .info-company {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        margin-right: 30px;
      }

      .icon-group {
        width: 140px;
        display: flex;
        justify-content: space-evenly;

        .icon-btn {
          cursor: pointer;
        }

        .el-badge__content {
          border: none;
        }
      }
    }
  }
  .main_box .title_box {
    width: 100%;
    height: 58px;
    line-height: 58px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #e6e6e6;
    margin-top: 5px;
    i {
      color: #4d84ff;
      font-size: 18px;
    }
    .title_type {
      position: relative;
      // 解决行内元素间距问题，勿删
      font-size: 0;
      > span {
        font-size: 16px;
        vertical-align: bottom;
      }
      i {
        vertical-align: middle;
      }
      .el-image {
        position: relative;
        bottom: -3px;
        vertical-align: top;
      }
    }
  }
  .main_box .title_accoun {
    display: flex;
    justify-items: flex-start !important;
  }

  .main_box {
    .el-button {
      font-weight: 400;
      span {
        color: #4d84ff;
      }
    }
    background-color: #fff;
    width: 1200px;
    margin: 0 auto;
    padding: 20px 0 40px 40px;
    .title_type {
      font-size: 16px;
      color: #333;
      .el-image {
        margin-right: 7px;
      }
    }
    .title_icon {
      font-size: 18px;
      margin-right: 5px;
    }
    .edit {
      cursor: pointer;
      margin-right: 42px;
      color: #2371c5;
    }
    .profile_box {
      padding: 25px;
      padding-left: 92px;
      padding-top: 8px;
    }
    .profile_set_box {
      padding: 0;
      position: relative;
      left: 92px;
    }
    .profile_box::after {
      content: '';
      height: 0;
      line-height: 0;
      display: block;
      visibility: hidden;
      clear: both;
    }
    .profile_box_item {
      width: 435px;
      height: 40px;
      line-height: 68px;
      float: left;
      display: flex;
      justify-content: flex-start;
    }
    .idCard {
      position: relative;
      left: -14px;
    }
    .account_profile_box_item {
      width: 435px;
      height: 68px;
      line-height: 68px;
      float: left;
      display: flex;
      justify-content: flex-start;
      margin: 23px 135px 40px 0;
      i {
        font-size: 26px;
        color: #4d84ff;
      }
    }
    .icon_box {
      width: 26px;
      height: 70px;
      margin-right: 20px;

      .el-image {
        width: 26px;
        height: 26px;
        top: 15px;
        img {
          width: 26px;
          height: 26px;
        }
      }
    }
    .set_icon {
      font-size: 28px;
      font-weight: bold;
      color: #f09850;
    }
    .account_box {
      div {
        height: 30px;
        line-height: 30px;
      }
      .account_title {
        font-size: 16px;
        color: #333;
        .account_title_name {
          color: #333;
          margin-right: 17px;
        }
        .adopt {
          color: rgb(44, 188, 48);
        }
        .refuse {
          color: rgb(240, 157, 73);
        }
        .iconpc-alert_ywcrz1x {
          color: rgb(44, 188, 48);
        }
        .iconpc-alert_wrzsq1x {
          color: rgb(240, 157, 73);
        }
        i {
          font-size: 16px;
          margin-right: 7px;
        }
      }
      .account_prompt {
        width: 500px !important;
        color: #999;
        font-size: 14px;
      }
      .el-button {
        color: #2371c5;
        // margin-right: 20px;
        // margin-left: -8px;
        cursor: pointer;
        i {
          font-size: 14px;
          margin-right: 3px;
        }
      }
      .unauthenticated {
        color: #ffa84f;
        font-size: 14px;
        margin-left: 0 !important;
      }
      .isOk {
        color: #9cd17c;
        font-size: 14px;
        margin-left: 0 !important;
      }

      .gotosure span {
        margin-left: -5px;
      }
      .cuury_phone {
        color: #db5063;
        margin-left: 10px;
      }
      .we_chat {
        margin-right: 15px;
        color: #000;
      }
    }
    .account_title_box {
      margin-top: 50px;
    }
    .el-dialog__title {
      font-size: 14px !important;
      font-weight: bold;
      color: #338ced;
    }
    .we_chat {
      margin-right: 0;
    }

    .IconPerson,
    .weirenzheng,
    .shuru,
    .girlIcon,
    .boyIcon,
    .yinzhangIcon,
    .weixin2,
    .zhseIcon {
      width: 18px;
      height: 18px;
    }
    .shuru,
    .yirenzheng,
    .weirenzheng {
      width: 14px;
      height: 14px !important;
      margin-left: 12px;
      margin-right: 4px;
      margin-bottom: -2px;
    }
    .profile_label {
      color: #999;
      font-size: 14px;
      margin-right: 30px;
    }
    .cuury_phone {
      color: #db5063;
      font-size: 16px;
      margin-right: 16px;
    }
  }
  .el-breadcrumb-style {
    margin: 0 auto;
    padding: 0;
    width: 1200px;
    margin-top: 13px;
    margin-bottom: 13px;
    font-weight: 400;
    .text-style {
      color: #999;
      span {
        font-weight: 400;
      }
    }
    #last-breadcrumb-item {
      font-size: 16px;
      .el-breadcrumb__inner,
      i {
        color: #333;
      }
    }
  }

  .el-icon-check {
    background: url('../../../m-front-common/pc/assets/img/qy-icon.png');
    background-size: cover;
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }
  .el-icon-check::before {
    content: '替';
    visibility: hidden;
  }

  .el-icon-check-glyzl {
    background: url('../../../m-front-common/pc/assets/img/glyzl-icon.png');
    background-size: cover;
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }
  .el-icon-check-glyzl::before {
    content: '替';
    visibility: hidden;
  }

  .el-icon-check-setting {
    background: url('../../../m-front-common/pc/assets/img/zhsz-icon.png');
    background-size: cover;
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }
  .iconpc-other_qyzx_sjgl1x {
    margin-right: 8px;
  }
  .el-icon-check-setting::before {
    content: '替';
    visibility: hidden;
  }
  .el-icon-check-signature-setting {
    background: url('../../../m-front-common/pc/assets/img/dzqz-icon.png');
    background-size: cover;
    width: 18px;
    height: 18px;
    margin-right: 8px;
  }
  .el-icon-check-signature-setting::before {
    content: '替';
    visibility: hidden;
  }
  .el-icon-check-certified {
    background: url('../../../m-front-common/pc/assets/img/pass-icon.png');
    background-size: cover;
    width: 22px;
    height: 18px;
    margin-right: 53px;
  }
  .el-icon-check-certified::before {
    content: '替';
    visibility: hidden;
  }
  .el-icon-check-nocertified {
    background: url('../../../m-front-common/pc/assets/img/fail-icon.png');
    background-size: cover;
    width: 22px;
    height: 18px;
    margin-right: 53px;
  }
  .el-icon-check-nocertified::before {
    content: '替';
    visibility: hidden;
  }

  .el-icon-check-management {
    background: url('../../../m-front-common/pc/assets/img/zuzhiguanli.png');
    background-size: cover;
    width: 26px;
    height: 26px;
    margin-right: 53px;
  }
  .el-icon-check-management::before {
    content: '替';
    visibility: hidden;
  }

  .el-icon-check-jiaoseguanli {
    background: url('../../../m-front-common/pc/assets/img/jiaoseguanli.png');
    background-size: cover;
    width: 18px;
    height: 18px;
    margin-right: 53px;
  }
  .el-icon-check-jiaoseguanli::before {
    content: '替';
    visibility: hidden;
  }

  .el-icon-check-yonghuguanli-2 {
    background: url('../../../m-front-common/pc/assets/img/yonghuguanli-2.png');
    background-size: cover;
    width: 18px;
    height: 18px;
    margin-right: 53px;
  }
  .el-icon-check-yonghuguanli-2::before {
    content: '替';
    visibility: hidden;
  }

  .image-div {
    display: flex;
    justify-content: center;
    margin: 5px;
  }

  .nav-box {
    height: 100%;
    .el-main {
      padding: 16px 48px;
      .system-classify-box {
        margin: 0 auto;
        padding: 0;
        width: 1200px;
        overflow: hidden;
        background-color: #fff;
        padding-bottom: 50px;

        .line {
          border-bottom: #dfe6ee 1px solid;
          width: 100%;
          margin-left: 41px;
          margin-top: 15px;
        }

        .line-2 {
          border: 1px dashed #d8d8d8;
          width: 81%;
          margin-left: 170px;
        }

        .classify-title {
          font-size: 16px;
          color: #333;
          letter-spacing: 0;
          margin-top: 31px;
          margin-left: 41px;
          .el-button--text {
            color: #4d84ff;
          }
          .left-title {
            font-size: 0;
            i {
              vertical-align: middle;
            }
            > span {
              font-size: 16px;
              vertical-align: middle;
            }
          }
        }

        .right-edit-style {
          font-size: 14px;
          letter-spacing: 0;
          float: right;
          margin-right: 41px;
        }

        .right-operation {
          font-size: 14px;
          letter-spacing: 0;
          float: right;
          margin-right: 42px;
        }

        .el-row-data {
          margin-left: 161px;
          margin-top: 19px;
        }
        .left-999-text {
          font-size: 14px;
          color: #999;
          letter-spacing: 0;
          text-align: right;
          line-height: 30px;
        }

        .right-333-text {
          font-size: 14px;
          color: #333;
          letter-spacing: 0;
          text-align: right;
          line-height: 30px;
          padding-left: 20px;
        }

        .right-999-text {
          font-size: 14px;
          color: #999;
          letter-spacing: 0;
          text-align: right;
          line-height: 30px;
          padding-left: 37px;
        }
        .right-666-text {
          font-size: 14px;
          color: #666;
          letter-spacing: 0;
          line-height: 30px;
        }
        .left-333-text {
          font-size: 16px;
          color: #333;
          letter-spacing: 0;
          padding-right: 37px;
          border-right: #e3e3e3 1px solid;
        }
        .left-333-text-2 {
          font-size: 16px;
          color: #333;
          letter-spacing: 0;
          padding-right: 100px;
          border-right: #e3e3e3 1px solid;
        }

        .el-row-account {
          margin-left: 183px;
          margin-top: 25px;
          margin-bottom: 10px;
        }
        .el-row-signature {
          margin-left: 183px;
          margin-top: 25px;
          margin-bottom: 10px;
        }
      }
      .system-no-data {
        font-size: 16px;
        text-align: center;
        padding: 15px;
        border-radius: 5px;
        margin: 30px 30%;
        border: 1px solid #ccc;
        color: #606266;
      }
    }
  }
  .text {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
  }
  .el-tabs__nav-scroll {
    display: flex;
    justify-content: center;
  }

  .dialog-password {
    .el-dialog {
      .el-form-item__content {
        display: flex;
        .getCode {
          border: none;
          height: 34px;
          margin-top: 1px;
          margin-left: 5px;
        }
      }
    }
    .foot {
      text-align: center;
    }
  }
  .person-dialog-box {
    overflow: hidden;
    .el-dialog {
      position: relative;
      height: 540px;
      .el-dialog__header {
        border-bottom: 0;
        padding: 20px 0 0 20px;
      }
      .el-dialog__body {
        padding-top: 14px;
        padding-bottom: 0;
        .title_list {
          width: 100%;
          display: flex;
          justify-content: center;
          align-items: center;
          margin-bottom: 24px;
          div {
            font-size: 14px;
            color: #909db0;
            position: relative;
            cursor: pointer;
            margin-right: 32px;
            .activeBorder {
              position: absolute;
              width: 20px;
              background-color: rgba(35, 113, 197, 1);
              height: 2px;
              // left: 0px;
              left: 50%;
              bottom: -6px;
              transform: translate(-50%);
            }
          }
          .activeDiv {
            font-weight: 600;
            color: rgba(35, 113, 197, 1);
            font-size: 20px;
          }
        }
        .userContent {
          position: relative;
          height: 360px;
          overflow: auto;
          .userName {
            display: flex;
            color: #a7b1c7;
            font-size: 14px;
            margin-bottom: 32px;
            div {
              width: 387px;
            }
            span {
              color: #26344c;
              margin-left: 8px;
            }
          }

          margin-left: 92px;
          .el-form {
            .el-input {
              width: 357px !important;
            }
            .el-form-item.is-error {
              margin-bottom: 32px;
            }
          }
          .photo_box {
            display: flex;
          }
        }
        .el-form-item--medium {
          .el-form-item__label {
            line-height: 20px;
          }
        }
      }
      .el-dialog__footer {
        border-top: 0;
        .dialog-footer {
          text-align: center;
          .el-button--medium {
            padding: 15px 145px;
          }
        }
        .operation_switching {
          background: white;
        }
      }
    }

    .el-form {
      .el-input {
        width: 211px;
      }
    }

    .dialog-box {
      .el-input {
        width: 211px;
      }
    }
  }
  .el-breadcrumb__inner.is-link,
  .el-breadcrumb__inner a {
    color: #999;
    font-size: 16px;
  }
  .el-breadcrumb__item:last-child .el-breadcrumb__inner,
  .el-breadcrumb__item:last-child .el-breadcrumb__inner:hover,
  .el-breadcrumb__item:last-child .el-breadcrumb__inner a,
  .el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover {
    color: #001700;
    font-size: 16px;
    font-weight: 400;
  }
}
</style>
